/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2020-2021.
 * Description: slave core header file
 * Author: yanbo <joey.yanbo@huawei.com>
 * Create: 2020-11-19
 */
#ifndef MACH_SMP_SLAVE_H
#define MACH_SMP_SLAVE_H

#define HISI_BOOT_MAGIC_NUM     0xa5a5a5a5
#define HISI_BOOT_MAGIC_NUM_L   0xa5a5
#define HISI_BOOT_MAGIC_NUM_H   0xa5a5
#define L2INVAL_DISABLE         (0)
#define L2INVAL_ENABLE          (1)

/*
 * SLAVE_CORE_BOOT_AREA_SIZE the area size for code + data section.
 */
#define SLAVE_CORE_BOOT_AREA_SIZE	0x1000

#ifdef	CONFIG_START_MEM_2M_ALIGN
	#define BOOT_ALIGN_MASK			0xffe00000
#else
	#define BOOT_ALIGN_MASK			0xff000000
#endif
/*
 * DDR start area used for slave core boot up; the area layout is as below:
 * 0x0 ~ 0x5ff is used for code & data section (use low addr 0x0 fisrt);
 * 0x600 ~ 0x6ff is used for store slave core init info (use low addr 0x600 fisrt);
 * 0x700 ~ 0x7bf is used for non-sec feature;
 * 0x7c0 ~ 0x7ff is reserve for other HAL sub system features;
 * 0x800 ~ 0xdff is used for stack when slave core boot up calling C func (decrease stack, use high addr 0xdfc first);
 * 0xe00 ~ 0xfff is used for HAL sub system self-debug(use low addr 0xe00 first).
 * BTW: 0x1000~0x2fff is reserve for dtb, to compatible with prev version; 0x3000 ~ above, used for ori kernel.
 */

#define HISI_BOOT_ADDR_OFFSET1		0x600
#define HISI_BOOT_MAGIC_OFFSET1		0x604
#define HISI_BOOT_ADDR_OFFSET2		0x608
#define HISI_BOOT_MAGIC_OFFSET2		0x60c
#define HISI_BOOT_L1INVALID_STORE	0x614
#define HISI_BOOT_TIMES_STORE	0x618
#define HISI_BOOT_L2INVALID_STORE       0x61c
#define HISI_SYS_PHYS_ADDR_STORE	0x620
#ifdef CONFIG_RTOS_HAL_CORE_RESET_LOG
#define HISI_BOOT_LOG_ADDR_OFFSET	0x624
#endif


/* for non secure feature. */
#define HISI_MASTERCORE_NONSEC		0x700
#define HISI_SLAVECORE_NONSEC		0x704
#define HISI_NONSEC_GICADDR_STORE       0x708
#define HISI_NONSEC_MAXIRQ_STORE        0x70c
#define HISI_NONSEC_NR_GIC_CPU		0x718

#define HISI_NONSEC_START_MAGIC_ADDR	0x720

#ifdef CONFIG_RTOS_HAL_INVALIDATE_BTB
#define HISI_FLAG_OFFSET		0x7c0
#endif

#define NONSEC_START_MAGIC		0xa55a1ee1
#define NONSEC_END_MAGIC		0xb77b3cc3


/* 0x800~0xfff is used for no-secure's stack */
#define HISI_NONSEC_STACK_ADDR		0xe00

#endif
